# Single Redis operator for Kubernetes

Single Redis operator runs single Redis instance, just one Pod.

Tested on: 1.19, 1.27

## Build sources

- You definitly need a Golang installed
- Clone repository https://git.blindage.org/21h/single-redis-operator to your computer
- Build

## Prebuilt images

You can find images here https://hub.docker.com/r/iam21h/single-redis-operator

## Deploy operator

### Helm

```
helm repo add 21h https://charts.blindage.org
helm repo update
helm install single-redis-operator 21h/single-redis-operator -n operators
```

## Your first Redis deployment

This resource can help you run your first Redis instance

```
---
apiVersion: blindage.org/v1
kind: SingleRedis
metadata:
  name: cb-radio-redis
  namespace: default
spec:
  image: redis
  # pullPolicy: Always

  # set size if you want make persistent volume
  persistentVolumeSize: 1Gi
  persistentVolumeClass: "nfs"

  # also delete pvc if this resource was deleted to keep house clean
  persistentVolumePurge: true

  # set data volume mount path if custom config used, default is /data
  # also used in default config file as data directory
  persistentVolumePath /var/redis/data

  # set custom redis.conf
  # if not specified will be generated automaticaly with options:
  # tcp-keepalive 60
  # save 900 1
  # save 300 10
  configmap: my-configmap

  # set resources limits
  # podRequests:
  # podLimits:

  # other k8s-specified options
  # affinity: 
  # nodeSelector: 
  # tolerations: 

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: my-configmap
  namespace: default
data:
  redis.conf: |
    dir /var/redis/data
    tcp-keepalive 60
    save 900 1
    save 300 10
```

Open file `api/v1/singleredis_types.go` to know more about options.

---
Copyright by Vladimir Smagin (21h) 2021  
https://blindage.org email: 21h@blindage.org  
Project page: https://git.blindage.org/21h/single-redis-operator
